package top.hcode.hoj.utils;

import org.springframework.context.ApplicationEventPublisher;

/**
 * @author orangej
 * @since 2025/2/10
 */
public class EventUtil {

    private static ApplicationEventPublisher eventPublisher;
    static ApplicationEventPublisher eventPublisher() {
        if (eventPublisher == null) {
            eventPublisher = ContextUtil.getBean(ApplicationEventPublisher.class);
        }
        return eventPublisher;
    }

    public static void publishEvent(Object event) {
        eventPublisher().publishEvent(event);
    }
}
